import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/constants/font_family.dart';
import 'package:flutter_eve_plugin/constants/font_weight.dart';
import 'package:flutter_eve_plugin/utils/screen_util.dart';
import 'package:flutter_eve_plugin/utils/image_util.dart';

class CheckpointPhysDialog extends Dialog {
  CheckpointPhysDialog({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          width: setRatio(311),
          height: setRatio(191),
          decoration: BoxDecoration(
              gradient: LinearGradient(
                colors: [
                  Color(0xFF4C4F5D),
                  Color(0xFF757C90),
                ],
                begin: Alignment.topCenter,
                end: Alignment.bottomCenter,
              ),
              border: Border.all(color: Color(0xFFB6BED7), width: setRatio(1)),
              borderRadius: BorderRadius.circular(setRatio(10))),
          child: Stack(
            overflow: Overflow.visible,
            children: <Widget>[
              Padding(
                padding: EdgeInsets.only(
                    left: setRatio(45), right: setRatio(45), top: setRatio(60)),
                child: RichText(
                  textAlign: TextAlign.center,
                  text: TextSpan(
                      style: TextStyle(
                          color: Color(0xFFFFFFFF),
                          fontFamily: FontFamily.PINGFANG,
                          fontWeight: FontWeightCustom.PF_Medium,
                          fontSize: setTextSp(15)),
                      children: [
                        TextSpan(text: '本次挑战需要消耗的体力不足，无法挑战，是否'),
                        TextSpan(
                            text: '前往补充',
                            style: TextStyle(color: Color(0xFFFFBF13))),
                        TextSpan(text: '？'),
                      ]),
                ),
              ),
              Positioned(
                top: setRatio(-24),
                left: setRatio(80),
                child: Container(
                  width: setRatio(151),
                  height: setRatio(44),
                  decoration: BoxDecoration(
                      image: DecorationImage(
                          image: AssetImage(imageUtilYeXiu(
                              'checkpoint/icon_center_dialog_title_bg@3x')))),
                  child: Center(
                    child: Text(
                      '体力不足',
                      style: TextStyle(
                          color: Color(0xFFFFFFFF),
                          fontFamily: FontFamily.PMZD,
                          fontSize: setTextSp(19)),
                    ),
                  ),
                ),
              ),
              Positioned(
                bottom: setRatio(24),
                child: Container(
                  width: setRatio(311),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      GestureDetector(
                        onTap: () {
                          if (Navigator.canPop(context)) {
                            Navigator.pop(context);
                          }
                        },
                        child: Container(
                          width: setRatio(110),
                          height: setRatio(42),
                          decoration: BoxDecoration(
                              image: DecorationImage(
                                  image: AssetImage(imageUtilYeXiu(
                                      'checkpoint/icon_center_dialog_cancel@3x')))),
                          child: Center(
                            child: Text(
                              '再想想',
                              style: TextStyle(
                                  color: Color(0xFFFFFFFF),
                                  fontFamily: FontFamily.PINGFANG,
                                  fontWeight: FontWeightCustom.PF_Medium,
                                  fontSize: setTextSp(15)),
                            ),
                          ),
                        ),
                      ),
                      GestureDetector(
                        onTap: () {
                          if (Navigator.canPop(context)) {
                            Navigator.pop(context);
                          }
                        },
                        child: Container(
                          width: setRatio(110),
                          height: setRatio(42),
                          decoration: BoxDecoration(
                              image: DecorationImage(
                                  image: AssetImage(imageUtilYeXiu(
                                      'checkpoint/icon_center_dialog_confirm@3x')))),
                          child: Center(
                            child: Text(
                              '立即前往',
                              style: TextStyle(
                                  color: Color(0xFFFFFFFF),
                                  fontFamily: FontFamily.PINGFANG,
                                  fontWeight: FontWeightCustom.PF_Medium,
                                  fontSize: setTextSp(15)),
                            ),
                          ),
                        ),
                      )
                    ],
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
